// 获取公共路由
import { constantRoutes } from '@/router/index'

export default {
  // 命名空间
  namespaced: true,
  state: {
    // 当前用户的路由数组
    routes: constantRoutes
  },
  mutations: {
    // 更新路由
    updataRoute(state, newRoute) {
      // 更加新路由newRoute
      state.routes = [...state.routes, ...newRoute]
    },
    // 重置路由
    resetRoute(state) {
      state.routes = constantRoutes
    }
  }

}
